package com.changgou.item.controller;

import com.changgou.item.service.PageService;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Author: wzw
 * @Date: 2020/12/18 23:52
 * @version: 1.8
 */
@Controller
@RequestMapping("/page")
public class PageController {

    //注入service
    @Autowired
    private PageService pageService;

    /**
     * 生成静态页
     * @param id
     * @return
     */
    @GetMapping("/createHtml/{id}")
    public Result createHtml(@PathVariable(name = "id") Long id) {
        // 生成静态页码
        pageService.createHtml(id);
        // 返回结果
        return new Result(true, StatusCode.OK, "生成静态页面成功");

    }
}
